import { Column, Entity, PrimaryColumn, OneToMany } from "typeorm";
import { ManualTimestamp } from "../decorators/manual-timestamp.decorator";
import { CharacterLocationEntity } from "./character-location.entity";

@Entity("map_areas")
@ManualTimestamp()
export class MapAreaEntity {
  @PrimaryColumn({ type: "int", comment: "地图区域ID" })
  id!: number;

  @Column({ type: "varchar", length: 100, comment: "地图区域名称" })
  name!: string;

  @Column({
    name: "parent_id",
    type: "int",
    nullable: true,
    comment: "父级区域ID" })
  parentId?: number;

  @Column({
    type: "varchar",
    length: 50,
    nullable: true,
    comment: "扩展字段(如等级信息)" })
  extension?: string;

  @Column("datetime", { name: "created_at", comment: "创建时间" })
  created_at!: Date;
@Column("datetime", { name: "updated_at", nullable: true, comment: "更新时间" })
  updated_at!: Date | null;
// 关联关系
  // @OneToMany => CharacterLocationEntity, (location) => location.area)
  // characterLocations!: CharacterLocationEntity[];
}
